# dieti.mod
# formulation for the diet problem with integrality requirement. 

set NUTR;

set FOOD;

param cost {FOOD} > 0;

param f_min {FOOD} >= 0;

param f_max {j in FOOD} >= f_min[j];

param n_min {NUTR} >= 0;

param n_max {i in NUTR} >= n_min[i];


param amt {NUTR,FOOD} >= 0;
 

var Buy {j in FOOD} integer >= f_min[j], <= f_max[j];


minimize total_cost: sum {j in FOOD} cost[j] * Buy[j];

subject to diet {i in NUTR}:

n_min[i] <= sum {j in FOOD} amt[i,j] * Buy[j] <= n_max[i];


## before solving 
# option cplex_options 'mipdisplay=1';
# option cplex_options 'mipdisplay=2' 'mipinterval=1';
# to get information about the branch and bound tree 

# the first option alone prints only the integral nodes
#The second line   prints information about all the nodes 

